package com.tuomaxu.webapps.demo1.server;

import com.tuomaxu.pojo.Request;
import com.tuomaxu.pojo.Response;
import com.tuomaxu.servlet.HttpServlet;
import com.tuomaxu.utils.ServerXmlParserUtil;

import java.io.IOException;

public class Demo1Servlet extends HttpServlet {

    @Override
    public void doGet(Request request, Response response) throws IOException {
        //根据request获取index.html的绝对路径
        response.write(getAbsolutePath(request));
    }

    @Override
    public void doPost(Request request, Response response) throws IOException {
        //根据request获取index.html的绝对路径
        response.write(getAbsolutePath(request));
    }

    private String getAbsolutePath(Request request){
        return ServerXmlParserUtil.appBase + "/demo1" + "/index.html";
    }
}
